<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>员工管理</title>
<jsp:include page="/WEB-INF/views/common/link.jsp" />

</head>
<body class="hold-transition skin-blue sidebar-mini">

	<div class="wrapper">
		<%@include file="/WEB-INF/views/common/navbar.jsp"%>
		<!--菜单回显-->
		<c:set var="currentMenu" value="employee" />
		<%@include file="/WEB-INF/views/common/menu.jsp"%>
		<div class="content-wrapper">
			<section class="content-header">
				<h1>员工管理</h1>
			</section>
			<section class="content">
				<div class="box">
					<!--高级查询--->
					<form class="form-inline" id="searchForm" action="/employee/list" method="post">
						<input type="hidden" name="currentPage" id="currentPage" value="1">
						<a href="/employee/edit" class="btn btn-success inputBtn" style="margin: 10px">
							<span class="glyphicon glyphicon-plus"></span>
							添加
						</a>
					</form>
					<!--编写内容-->
					<div class="box-body table-responsive no-padding ">
						<table class="table table-hover table-bordered">
							<tr>
								<th>编号</th>
								<th>账号</th>
								<th>姓名</th>
								<th>邮箱</th>
								<th>年龄</th>
								<th>入职时间</th>
								<th>管理员</th>
								<th>状态</th>
								<th>部门</th>
								<th>操作</th>
							</tr>
							<c:forEach var="emp" items="${pageResult.list}" varStatus="vs">
								<tr>
									<td style="width: 50px" align="center">${vs.count}</td>
									<td>${emp.username}</td>
									<td>${emp.name}</td>
									<td>${emp.email}</td>
									<td>${emp.age}</td>
									<td>
										<fmt:formatDate value="${emp.hiredate}" pattern="yyyy-MM-dd"/>
									</td>
									<td>${emp.admin ? "是":"否"}</td>
									<td>${emp.status ? "启用" : "注销"}</td>
									<td>${emp.dept.name}</td>
									<td>
										<a class="btn btn-info btn-xs inputBtn" href="/employee/edit?id=${emp.id}">
											<span class="glyphicon glyphicon-pencil"></span>
											编辑
										</a>
										<a href="#" class="btn btn-danger btn-xs btn_handle" data-msg="注销用户" data-url="/employee/updateStatus?id=${emp.id}&status=false">
											<span class="glyphicon glyphicon-trash"></span>
											注销
										</a>
                                        <a href="#" class="btn btn-success btn-xs btn_handle" data-msg="启用用户" data-url="/employee/updateStatus?id=${emp.id}&status=true">
                                            <span class="glyphicon glyphicon-ok"></span>
                                            启用
                                        </a>
										<a class="btn btn-info btn-xs inputBtn" href="/employee/bindRoleEdit?id=${emp.id}">
											<span class="glyphicon glyphicon-user"></span>
											角色绑定
										</a>
									</td>
								</tr>
							</c:forEach>
						</table>
						<!--分页-->
						<%@include file="/WEB-INF/views/common/page.jsp"%>
					</div>
				</div>
			</section>
		</div>
		<%@include file="/WEB-INF/views/common/footer.jsp"%>
	</div>
</body>
</html>
